package com.yanqu.road.server.manger.kowloon.battle.buff;

import com.yanqu.road.server.manger.kowloon.battle.KowloonGame;
import com.yanqu.road.server.manger.kowloon.battle.role.bullet.KowloonBullet;
import com.yanqu.road.server.manger.kowloon.battle.role.enemy.KowloonEnemy;

import java.util.ArrayList;
import java.util.List;

/**
 * 持续掉血
 */
public class KowloonBuff3 extends KowloonBuff {

    public KowloonBuff3(KowloonGame game, KowloonBullet bullet, KowloonEnemy owner) {
        super(game, bullet, owner);
    }

    @Override
    public List<KowloonBuffEffect> getBuffEffect() {
        return new ArrayList<>();
    }

    @Override
    public void initData() {
        this.effectTime = this.startTime + this.baseData.getParam().get(0);
    }

    @Override
    public void processEffect() {
        if (game.gameTime >= this.effectTime) {
            long damage = (long) Math
                    .floor(+this.caster.getData().getProperty().getAttack() * this.baseData.getProbability() / 1000.0);
            this.owner.beHurt(this.type, damage);
            this.effectTime += this.baseData.getParam().get(0);
        }
    }
}
